package com.example.jpa.crud.repository;

import java.util.Map;
import java.util.List;

import com.example.jpa.crud.model.ResourceModel;
import com.example.jpa.crud.search.SearchCondition;
import com.example.jpa.crud.search.SortCondition;

public interface SimpleCrudRepository {

    Map<String, Object> create(ResourceModel model, Map<String, Object> entity);

    Map<String, Object> findById(ResourceModel model, Object id);

    int deleteById(ResourceModel model, Object id);

    int updateById(ResourceModel model, Object id, Map<String, Object> entity);

    SearchCondition resolveSearchExpression(ResourceModel model, String searchExpression, Map<String, List<String>> params);

    SortCondition resolveSortExpression(ResourceModel model, String sortExpression);

    Long count(ResourceModel model, SearchCondition searchCondition);

    List<Map<String, Object>> search(ResourceModel model, SearchCondition searchCondition, SortCondition sortCondition, Long page, Long size);

}